﻿
using System.Windows;
using System.Windows.Input;


namespace MainUI
{
    public partial class RegionSelectorWindow : Window
    {
        private Point _startPoint;
        public Rect SelectedRegion { get; private set; }

        public RegionSelectorWindow()
        {
            InitializeComponent();
            WindowStyle = WindowStyle.None;
            WindowState = WindowState.Maximized;
            Topmost = true;
            Cursor = Cursors.Cross;
        }

        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            _startPoint = e.GetPosition(this);
            base.OnMouseDown(e);
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                var currentPoint = e.GetPosition(this);
                SelectedRegion = new Rect(_startPoint, currentPoint);
            }
        }

        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            DialogResult = true;
            Close();
        }
    }
}
